package com.ruoyi.auth.config;

import org.springframework.amqp.support.converter.SimpleMessageConverter;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

import java.util.Arrays;

@Configuration
public class RabbiMQConfig {
    /**
     * 配置RabbitMQ消息转换器，添加允许反序列化的类
     */
    @Bean
    public SimpleMessageConverter simpleMessageConverter() {
        SimpleMessageConverter converter = new SimpleMessageConverter();
        // 添加允许反序列化的类（替换为你的实际类全路径）
        converter.setAllowedListPatterns(
                Arrays.asList(
                        "com.ruoyi.auth.domain.SmsMessage",
                        "java.util.*",
                        "java.lang.*"
                )
        );
        return converter;
    }
}
